<template>
  <div class="container consult">
    <div class="head-new-list">
      <p class="head-new-title">{{ title }}</p>
      <div class="new-detai">
        <span class="lable"> {{ lable }}</span>
        <span class="time">{{ author }} </span>
        <span class="circle"></span>
        <span class="time"> {{ publicTime }}</span>
      </div>
    </div>
    <div class="content" v-html="detailInfo"></div>
  </div>
</template>
<script>
/* eslint-disable */
export default {
  name: "articleInfo",
  data() {
    return {
      detailInfo: "",
      title: "",
      lable: "",
      publicTime: "",
      author: "",
    };
  },
  onLoad(op){
		this.pageType=op.pageType
		if(op.pageType=='0'){
			this.initArticle(op)
		}else{
		  this.initNotice(op)
			uni.setNavigationBarTitle({
				title:'通知详情'
			})
		}
   
  },
  methods: {
		initArticle(op){
			this.apis.commonApi.getNewsById(op.id).then(res=>{
			  let data=res.data
			  this.title = data.newsTitle;
			  this.lable =data.label;
			  this.publicTime =data.publicTime;
			  this.author = data.author;
			  this.detailInfo =data.newsContent.replace(
			      /\<img/gi,
			      '<img style="max-width:100%;height:auto; margin-top: 0px" '
			  ).replace(
			      /\<p/gi,
			      '<p style="line-height: 30px;font-size: 17px;color: #555555" '
			  );
			})
		},
		initNotice(op){
			this.apis.commonApi.getNoticeById(op.id).then(res=>{
			  let data=res.data
			  this.title = data.noticeTitle;
			  this.lable =data.noticeType=='1'?'通知':'公告';
			  this.publicTime =data.createTime;
			  this.author = data.remark;
			  this.detailInfo =data.noticeContent.replace(
			      /\<img/gi,
			      '<img style="max-width:100%;height:auto; margin-top: 0px" '
			  ).replace(
			      /\<p/gi,
			      '<p style="line-height: 30px;font-size: 17px;color: #555555" '
			  );
			})
		}
	},
};
</script>
<style scoped  lang="scss">
.head-new-list {
  width: 100%;
  padding: 40rpx;
  box-sizing: border-box;
  .head-new-title {
    font-size: 30rpx;
    font-weight: 500;
    color: #333333;
    line-height: 33px;
  }
  .new-detai {
    margin-top: 15rpx;
    display: flex;
    align-items: center;
    span {
      display: inline-block;
    }
    .lable {
      padding: 4rpx 6rpx;
      background: rgba(#999999,.1) ;
      border-radius: 2rpx;
      margin-right: 20rpx;
      font-size: 24rpx;
      font-weight: 400;
      color: #333333;
    }
    .time {
      font-size: 24rpx;
      color: #999999;
    }
    .circle {
      width: 3px;
      height:3px;
      margin: 0 5px;
      background: #999;
      border-radius: 50%;
    }
  }
}
.content {
  padding:0 40rpx 40rpx;
  img {
    width: 100%;
  }
}
</style>

